package com.cskaoyan.controller.admin.mallcontroller;

import com.cskaoyan.service.mallservice.RegionService;
import com.cskaoyan.vo.BaseRespVo;
import com.cskaoyan.vo.mallvo.RegionVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author hsp
 * @date 2021/5/8 22:44
 */
@RestController
public class RegionController {


    @Autowired
    RegionService regionService;

    /**
     *
     * @return
     * data:
     * [
     *     {
     *         "id": 1,
     *         "name": "北京市",
     *         "type": 1,
     *         "code": 11,
     *         "children": [{
     *             "id": 32,
     *             "name": "市辖区",
     *             "type": 2,
     *             "code": 1101,
     *             "children": [
     *                 {
     *                     "id": 376,
     *                     "name": "东城区",
     *                     "type": 3,
     *                     "code": 110101
     *                 },
     */
    @RequestMapping("admin/region/list")//admin/region/list
    public BaseRespVo region(){
        List<RegionVo> regionVOS = regionService.queryAll();
        return BaseRespVo.ok(regionVOS);
    }



}
